<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="${staticServer}/inc/style/main.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/page.css" />
<link rel="stylesheet" href="${staticServer}/css/work_today.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css" />
<link rel="stylesheet" href="${staticServer}/css/consultant_client_tracking.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css" />
<link rel="stylesheet" href="${staticServer}/css/consultant_client.css" />
<link rel="stylesheet" href="${staticServer}/css/consultant_client_tracking.css" />
<link rel="stylesheet" href="${staticServer}/css/consultant_student_read.css" />
<script src="${staticServer}/inc/js/jquery.js"></script>
<script src="${staticServer}/inc/js/pageset.js"></script>
<script src="${staticServer}/inc/js/model_resp.js"></script>
<script src="${staticServer}/inc/js/datepicker.js"></script>
<script src="${staticServer}/inc/js/htmlfilter.js"></script>
<script src="${staticServer}/inc/js/submitter.js"></script>
<script src="${staticServer}/inc/js/tips.js"></script>
<script src="${staticServer}/js/t/ask_answer_list.js?1.0"></script>
<script>
var infopad = parent.infopad;

function starquery(type){
	if(type==0)
	{
		/* var topic = $( '#topic' ).val();
		var contact = $( '#contact' ).val();
		var address = $( '#address' ).val();
		var spname = $( '#spname' ).val();
		var source = $( '#source' ).val();
		var stardate = $( '#stardate' ).val();
		var enddate = $( '#enddate' ).val();
		var state = $( '#state' ).val();
		var st_type = $( '#st_type' ).val(); */
		var contact = $( '#contact' ).val();
		var weixin = $( '#weixin' ).val();
		var address = $( '#address' ).val();
		var source = $( '#source' ).val();
		var stardate = $( '#stardate' ).val();
		var enddate = $( '#enddate' ).val();
		var state = $( '#state' ).val();
		var st_type = $( '#st_type' ).val(); 
		var money = $( '#money' ).val(); 
		var spname = $( '#spname' ).val();
		var money2 = $( '#money2' ).val();
		var params = [];
		if(!empty(contact)) params.push( "contact=" + contact );
		if(!empty(weixin)) params.push( "weixin=" + weixin );
		if(!empty(address)) params.push( "address=" + address );
		if(!empty(source)) params.push( "source=" + source );
		if(!empty(stardate)) params.push( "stardate=" + stardate );
		if(!empty(enddate)) params.push( "enddate=" + enddate );
		if(!empty(state)) params.push( "state=" + state );
		if(!empty(st_type)) params.push( "st_type=" + st_type );
		if(!empty(spname)) params.push( "spname=" + spname );
		if(!empty(money)) params.push( "money=" + money );
		if(!empty(money2)) params.push( "money2=" + money2 );
		location.href = "?" + params.join("&");
	}
	else
	{
	 $("#contact").val("");
	 $("#weixin").val("");
	 $("#address").val("");
	 $("#source").val("");
	 $("#stardate").val(""); 
	 $("#enddate").val("");
	 $("#state").val("");
	 $("#state").val("");
	 $("#st_type").val("");
	 $("#money2").val("");
	 $("#money").val("");
	}
}

$(function(){
	var state = "${vote.state1}${vote.state2}";
	$("#state").val(state);
	$("#source").val("${vote.source}");
	$("#st_type").val("${vote.st_type}");
})


function url(u){
if(u!=null && u!=""){
		window.open(u); 
	}
}

$(function(){
	//全选按钮 
	$("#allChecked").click(function(){
		if($(this).is(':checked')==true){
			$("#datas td input[type=checkbox]").prop("checked","true");
		}else{
			$("#datas td input[type=checkbox]").prop("checked",false);
		}
	});

});

var deleteClient = function(){
	var $obj = $("#datas td input[type=checkbox]:checked");
	if($obj.length == 0){
		alert("请至少选择一条记录");
		return ;
	}
	if(confirm("确定标记无效？标记无效后无法恢复。")){
		var ids = '';
		for(var i = 0;i<$obj.length;i++){
			if(i == $obj.length-1){
				ids += $($obj[i]).val();
			}else{
				ids += $($obj[i]).val()+",";
			}
		}
		var url = "${contextPath}/admin/deleteVoteById.json";
    	$.post(url, {"ids":ids}, 
			function(ms) {
	 			if(ms.msg != null){
	 				if(ms.msg == "1"){
	 					alert("标记无效成功!");
	 					setTimeout(function(){
	 						location.reload(); 
						},1200);
	 				}else{
	 					alert("抱歉，系统忙");
	 				}
	 			}else{
	 				alert("抱歉，系统忙");
	 			}
    	});
    };
}
</script>
</head>

<body>
	<div id="home_link">
		<ul>
			<li></li>
			<li>&gt;</li>
			<li>资源统计管理</li>
			<li>&gt;</li>
			<li class="current">问卷资源分配(总)</li>
		</ul>
	</div>
	<div id="container">
		<div id="title">红色表示重复资源，紫色表示无效资源，蓝色表示重复加无效资源。</div>
		<div class="fieldset_container">
			<fieldset>
				<legend>查询条件</legend>
				<ul>
					<!-- <li><label>电话号码：</label>
						<input type="text" id="contact" size="15" placeholder="电话号码" value="${vote.contact}" /></li>
						
						 -->
						<li><label>联系方式：</label>
						<input type="text" id="contact" size="15" placeholder="手机、QQ、邮箱" value="${vote.contact}" /></li>
					<li><label>微信号码：</label>
						<input type="text" id="weixin" size="15" placeholder="微信号码" value="${vote.weixin}" /></li>
					<li><label>城市：</label>
						<input type="text" id="address" size="15" placeholder="省、市、地址" value="${vote.city}" /></li>
					<li><label>起止日期：</label>
						<input type="text" id="stardate" size="13" rel="DATE::Y-m-d" value="${startTime}" />-
						<input type="text" id="enddate" size="13" rel="DATE::Y-m-d" value="${endTime}" /></li>
	
					
					<li><label>分配状态：</label>
						<select id="state">
							<option value="">--选择--</option>
							<option value="1">未分配</option>
							<option value="2">已分配</option>
						</select>
					</li>
					
					
					<li><label>来源渠道：</label>
						<select id="source">
							<option value="">-- 请选择 --</option>
							<option value="nupd5182xxsl">网站问卷</option>
							<option value="l6xdybjjrcjc">手机问卷</option>
							<option value="czhi7pjiadhu">19楼问卷</option>
							<option value="l6e69n6t0xdf">微博问卷</option>
							<option value="osjrem0am5af">微博粉丝通问卷</option>
							<option value="frvmppoifgmb">今日头条</option>
							<option value="43ADF8FC3964">微信公众号问卷</option>
							
						</select>
					</li>
					<li><label>录入人：</label><input type="text" id="spname" size="15" placeholder="推广人姓名" value="${vote.spname}" /></li>
					<li>
						<label>状态：</label>
						<select id="st_type">
							<option value="">全部资源</option>
							<option value="1">有效资源</option>
							<option value="2">无效资源</option>
						</select>
					</li>
					<li><label>报名金额：</label>
						<input type="text" id="money" size="5" placeholder="" value="${vote.money}" />&nbsp至
						<input type="text" id="money2" size="5" placeholder="" value="${vote.money2}" /></li>
		
					
					<li class="controlbar">
						<input type="button" value=" 查 询 " onclick="starquery(0)" /> 
						<input type="button" value=" 重 置 " onclick="starquery(1)" />
						<input type="button" value=" 标记无效 " onclick="deleteClient()" />
					</li>
				</ul>
			</fieldset>
		</div>
		<table>
			<tr class="fields">
				<th><input name="" type="checkbox" value="" id="allChecked"></th>
				<th >录入时间</th>
				<th >录入人</th>
				<th >分配咨询师</th>
				<th >渠道来源</th>
				<th >活动分类</th>
				<th>客户姓名</th>
				<th>所在地</th>
				<th>电话号码</th>
				<th>微信号码</th>
				<th>客户状态</th>
				<th>最新跟进情况</th>
				<th>缴费金额</th>
				<th>操作</th>
				<!-- <th style="min-width: 130px;">操作</th> -->
			</tr>
			
			<tbody id="datas">
		<#if list??>
			<#list list as list>
			<tr <#if list.ask_cn gt 0 && list.st_type=="2">style="color:#2D88A8"<#elseif list.ask_cn gt 0>style="color:red;"<#elseif list.st_type=="2">style="color:#A65BC2"</#if>>
				<td align="center"><input name="" type="checkbox" value="${list.id}"></td>
				<td  align="center">
				<span class="">${list.createTime}<br/>
				</td>
				
				
				<#if list.sourceTable == 0>
				<td  align="center"><span class="stress">${list.spname}</span></td>
   				<td align="center">
					<!-- <#if list.username??>已分配<#else>未分配</#if><br/> -->
					<#if list.nickname??><span class="stress">${list.nickname}</span><#else>未分配</#if>
				</td>
				<#elseif list.sourceTable == 1 || list.sourceTable==3>
				<td  align="center"><span class="stress">${list.nickname}</span></td>
   				<td align="center"><#if list.to_username??><span class="stress">${list.to_username}</span><#else>未分配</#if></td>
				<#elseif list.sourceTable == 2>
				<td  align="center"><span class="stress"></span></td>
   				<!-- <td align="center"><#if list.state=="1"><span class="stress">${list.nickname}</span><#else>未分配</#if></td> -->
   				<td align="center"><#if list.nickname??><span class="stress">${list.nickname}</span><#else>未分配</#if></td>
   				 <#else>
				</#if>
				
				
				<!-- <td align="center">${list.lianxiName}</td> -->
				
				
				
				<td align="center">${list.sourcens}</td>
				<td align="center">
				
				${list.type}&nbsp${list.typeName}
				</td>
				
				<td class="center">${list.clientName}</td>
				<td align="center">${list.city}</td>
				<td align="center" rel="nohover">
					<a title="电话：${list.phone}-QQ:${list.qq}-email:${list.email}"><em class="caption"  >电话：</em><br/><span>${list.phone}</span></a>
				</td>
				<td align="center">${list.weixin}</td>
				<td align="center">
				<#if list.state == 1>
   				 待确认
				<#elseif list.state == 2>
   				已出现
				<#elseif list.state == 3>
   				 已过期
   				 <#else>
				</#if>
				
				<td class="breakall"><div contenteditable="false" title="${list.lastTrack}">
				<#if list.lastTrack?length gt 15>${list.lastTrack?substring(0,15)}...<#else>${list.lastTrack}</#if></div><em class="caption" 
				title="${list.lastdate}">${list.lastdate}</em></td>
				<td align="center">${list.money}</td>
				<td align="center">  
				<#if list.sourceTable == 0>
					
				  <#if list.ask == 'zice'>
					<a target="_blank" href="http://www.taleu.com/zice.html?id=${list.id}" title="跳转到测评问卷查看具体结果">查看 </a> - 
				  <#elseif list.ask == 'wenjuan'>
				 	<a target="_blank" href="http://www.taleu.com/wenjuan.html?id=${list.id}" title="跳转到测评问卷查看具体结果">查看 </a> - 
				  <#else>
					<a target="_blank" href="../admin/ask.htm?key=${list.keyname}" title="跳转到测评问卷查看具体结果">查看 </a> - 
				  </#if>
					<#if list.username??>
						<a href="#" title="将该用户资源分配给指定的咨询师">分配</a></td>
					<#else>
						<a href="ask_allot.htm?id=${list.id}" title="将该用户资源分配给指定的咨询师">分配</a></td>
					</#if>
				
				
				
				<#elseif list.sourceTable == 1>	
					
				<#if haiQx?? && haiQx=="1">
							<a href="${contextPath}/consu/consultant_import_allot.htm?id=${list.id}&currPage=${currPage}" >分配</a>
						<#else>
						
						<#if webutil.getCookieUser().username=="he">
							<a href="${contextPath}/consu/consultant_import_add.htm?id=${list.id}&type=1" class="btnSearchTracking">编辑</a>
						<#else>
							<#if webutil.getCookieUser().username==list.username>
								<#if list.state=="1">
									<a href="${contextPath}/consu/consultant_import_add.htm?id=${list.id}&type=2" class="btnSearchTracking">查看</a> 
								<#else>
									<a href="${contextPath}/consu/consultant_import_add.htm?id=${list.id}&type=1" class="btnSearchTracking">编辑</a> 
								</#if>
							<#else>
								<a href="${contextPath}/consu/consultant_import_add.htm?id=${list.id}&type=2" class="btnSearchTracking">查看</a> 
							</#if>
							<#if webutil.getCookieUser().usergroup==9>
								<#if list.state=="1">
								 -<a href="#" >分配</a>
								 <#else>
								 -<a href="${contextPath}/consu/consultant_import_allot.htm?id=${list.id}&currPage=${currPage}" >分配</a>
								 </#if>
							</#if>
						</#if>
						
						</#if>
				
				
				
			
						
				<#elseif list.sourceTable == 2>	
						<#if list.username??>
						<a href="#" title="将该用户资源分配给指定的咨询师">分配</a>
					<#else>
						<a href="${contextPath}/admin/from_user_allot.htm?id=${list.id}" title="将该用户资源分配给指定的咨询师">分配</a>
					</#if>
				</#if>
				
					
					
					
					
					
					
					
			</tr>
			</#list>
		</#if>
		<tbody>
		</table>
	</div>
	<div id="pager">
	<ul id="pagination">
		<#if page??>
		<#if page.pagetotal?? && page.pagetotal!="0">
	<#assign pagetotal = page.pagetotal>
	<#else>
	<#assign pagetotal = 1>
	</#if>
			<#if page.currpage??>
	<#assign currpage = page.currpage>
	<#else>
	<#assign currpage = 1>
	</#if>
				<#if currpage==1 >
					<li class="previous-off">上一页</li>
					<#else>
					<li class="previous"><a href="${contextPath}/admin/ask_answer_list_new.htm?currPage=${currpage-1}&source=${vote.source}&state=${vote.state1}${vote.state2}&topic=${topic}&sname=${sname}&contact=${contact}&address=${address}&stardate=${startTime}&enddate=${endTime}&weixin=${weixin}&money=${money}&money2=${money2}">上一页</a></li>
					</#if>
					
		<#if pagetotal<=11>
			<#list 1..pagetotal as index_up>  
	           <#if currpage==index_up > 
	           		<li class="current">${index_up}</li>
	           <#else>
	           		<li><a href="${contextPath}/admin/ask_answer_list_new.htm?currPage=${index_up}&source=${vote.source}&state=${vote.state1}${vote.state2}&topic=${topic}&sname=${sname}&contact=${contact}&address=${address}&stardate=${startTime}&enddate=${endTime}&weixin=${weixin}&money=${money}&money2=${money2}">${index_up}</a></li>  
	           </#if>  
			</#list>  
		<#else>
			<#if currpage<=8 >
				<#list 1..9 as index_up>  
	           	<#if currpage==index_up >  
	            	<li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/admin/ask_answer_list_new.htm?currPage=${index_up}&source=${vote.source}&state=${vote.state1}${vote.state2}&topic=${topic}&sname=${sname}&contact=${contact}&address=${address}&stardate=${startTime}&enddate=${endTime}&weixin=${weixin}&money=${money}&money2=${money2}">${index_up}</a></li> 
	           	</#if>
	           	</#list>  
	           	<li>...</li>
	           	<li><a href="${contextPath}/admin/ask_answer_list_new.htm?currPage=${pagetotal}&source=${vote.source}&state=${vote.state1}${vote.state2}&topic=${topic}&sname=${sname}&contact=${contact}&address=${address}&stardate=${startTime}&enddate=${endTime}&weixin=${weixin}&money=${money}&money2=${money2}">${pagetotal}</a></li>  
				
			<#elseif (currpage>= 9 && currpage<pagetotal-7)  >	
				<li><a href="${contextPath}/admin/ask_answer_list_new.htm?currPage=1&source=${vote.source}&state=${vote.state1}${vote.state2}&topic=${topic}&sname=${sname}&contact=${contact}&address=${address}&stardate=${startTime}&endTime=${endTime}&weixin=${weixin}&money=${money}&money2=${money2}">1</a></li>  
				<li>...</li>
				<#list currpage-3..currpage+3 as index_up>  
	           	<#if currpage==index_up >  
	             <li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/admin/ask_answer_list_new.htm?currPage=${index_up}&source=${vote.source}&state=${vote.state1}${vote.state2}&topic=${topic}&sname=${sname}&contact=${contact}&address=${address}&stardate=${startTime}&endTime=${endTime}&weixin=${weixin}&money=${money}&money2=${money2}">${index_up}</a></li>  
	           	</#if>
	           	</#list>
				<li>...</li>
	           	<li><a href="${contextPath}/admin/ask_answer_list_new.htm?currPage=${pagetotal}&source=${vote.source}&state=${vote.state1}${vote.state2}&topic=${topic}&sname=${sname}&contact=${contact}&address=${address}&stardate=${startTime}&endTime=${endTime}&weixin=${weixin}&money=${money}&money2=${money2}">${pagetotal}</a></li>   
			<#else>
				<li><a href="${contextPath}/admin/ask_answer_list_new.htm?currPage=1&source=${vote.source}&state=${vote.state1}${vote.state2}&topic=${topic}&sname=${sname}&contact=${contact}&address=${address}&stardate=${startTime}&enddate=${endTime}&weixin=${weixin}&money=${money}&money2=${money2}">1</a></li> 
				<li>...</li>
				<#list pagetotal-8..pagetotal as index_up>  
	           	<#if currpage==index_up >  
	             <li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/admin/ask_answer_list_new.htm?currPage=${index_up}&source=${vote.source}&state=${vote.state1}${vote.state2}&topic=${topic}&sname=${sname}&contact=${contact}&address=${address}&stardate=${startTime}&enddate=${endTime}&weixin=${weixin}&money=${money}&money2=${money2}">${index_up}</a></li> 
	           	</#if>
				</#list>  
			</#if>
			
		</#if> 
		<#if currpage==pagetotal >
		 	<li class="previous-off">下一页</li>
		<#else>
			<li class="previous"><a href="${contextPath}/admin/ask_answer_list_new.htm?currPage=${currpage+1}&source=${vote.source}&state=${vote.state1}${vote.state2}&topic=${topic}&sname=${sname}&contact=${contact}&address=${address}&stardate=${startTime}&enddate=${endTime}&weixin=${weixin}&money=${money}&money2=${money2}">下一页</a></li>
		</#if>
		<li class="pageinfo">共${page.total}条记录</li>
	</#if>
	</ul>
	</div>
	<div class="emptyline"></div>
</body>
</html>